package com.woniu.mealsService.mapper;

import com.woniu.dto.RemoveByIdSqlDTO;
import com.woniu.dto.SelectProductByStoreIdDTO;
import com.woniu.mealsService.model.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 菜品表 Mapper 接口
 * </p>
 *
 * @author jiang
 * @since 2024年12月09日
 */
@Mapper
public interface ProductMapper extends BaseMapper<Product> {
    @Select("select product_id,product_name,product_intr,store_id,store_name from product where store_id=#{storeId} and product_del=0")
    List<SelectProductByStoreIdDTO> searchProductByStoreId(@Param("storeId") String storeId);
    @Update("update product set product_del=1,update_time=#{removeByIdSqlDTO.updateTime} where product_id=#{removeByIdSqlDTO.productId} and store_id=#{removeByIdSqlDTO.storeId} and product_del=0")
    Integer removeProductById(@Param("removeByIdSqlDTO") RemoveByIdSqlDTO removeByIdSqlDTO);
}
